import request from '@/config/axios'

// VIP购买记录 VO
export interface VipBuyHistoryVO {
  id: number // 编号
  vipSetMealId: number // VIP套餐
  vipSetMealName: string // 套餐名称
  expireTime: Date // 过期时间
  payStatus: boolean // 是否已支付
  payOrderId: number // 支付订单编号
  payChannelCode: string // 支付成功的支付渠道
  payTime: Date // 订单支付时间
}

// VIP购买记录 API
export const VipBuyHistoryApi = {
  // 查询VIP购买记录分页
  getVipBuyHistoryPage: async (params: any) => {
    return await request.get({ url: `/member/vip-buy-history/page`, params })
  },

  // 查询VIP购买记录详情
  getVipBuyHistory: async (id: number) => {
    return await request.get({ url: `/member/vip-buy-history/get?id=` + id })
  },

  // 新增VIP购买记录
  createVipBuyHistory: async (data: VipBuyHistoryVO) => {
    return await request.post({ url: `/member/vip-buy-history/create`, data })
  },

  // 修改VIP购买记录
  updateVipBuyHistory: async (data: VipBuyHistoryVO) => {
    return await request.put({ url: `/member/vip-buy-history/update`, data })
  },

  // 删除VIP购买记录
  deleteVipBuyHistory: async (id: number) => {
    return await request.delete({ url: `/member/vip-buy-history/delete?id=` + id })
  },

  // 导出VIP购买记录 Excel
  exportVipBuyHistory: async (params) => {
    return await request.download({ url: `/member/vip-buy-history/export-excel`, params })
  }
}
